$(function () {
    if (GetQueryString("name")=="2"){
       $(".hxgn-detTab.2").addClass("hxgn-active").siblings().removeClass("hxgn-active");
        $("."+$(".hxgn-detTab.2").attr("dataDiv")).addClass("news-midshow").siblings().removeClass("news-midshow");
        $(".wz").text($(".hxgn-detTab.2").attr("wz"));
    }else if (GetQueryString("name")=="3"){
        $(".hxgn-detTab.3").addClass("hxgn-active").siblings().removeClass("hxgn-active");
        $("."+$(".hxgn-detTab.3").attr("dataDiv")).addClass("news-midshow").siblings().removeClass("news-midshow");
        $(".wz").text($(".hxgn-detTab.3").attr("wz"));
    }else if (GetQueryString("name")=="4"){
        $(".hxgn-detTab.4").addClass("hxgn-active").siblings().removeClass("hxgn-active");
        $("."+$(".hxgn-detTab.4").attr("dataDiv")).addClass("news-midshow").siblings().removeClass("news-midshow");
        $(".wz").text($(".hxgn-detTab.4").attr("wz"));
    }

    $(".hxgn-detTab").click(function(){
        $(this).addClass("hxgn-active").siblings().removeClass("hxgn-active");
        $("."+$(this).attr("dataDiv")).addClass("news-midshow").siblings().removeClass("news-midshow");
        $(".wz").text($(this).attr("wz"));
        getArticle($(this).attr("articleType"))
    })
    
    
    getArticle(articleType);
    $(".news-title1 span[articleType="+articleType+"]").addClass("hxgn-active").siblings("span").removeClass("hxgn-active")
})

function getArticle(articleType){
	$.get("front/aboutsmk/aboutsmkDetail/"+articleType+".do",function(result){
		var articleData = result.article;
		var htmlStr = '';
		if(articleData){
			htmlStr += '<div class="deta-title">'+articleData.articleName+'</div>';
			htmlStr += '<div class="deta-titletime">';
			htmlStr += '发布时间：<span style="margin-right: 10px;">'+articleData.releaseTimeStr+'</span>阅读次数：<span>'+articleData.readNum+'</span>次';
			htmlStr += '</div>';
			htmlStr += '<div class="deta-nr">';
			htmlStr += '<div class="deta-nr">'+articleData.content+'</div>';
			htmlStr += '</div>';
		}
		$(".news-midshow").html("");
		$(".news-midshow").html(htmlStr);
	})
}

function GetQueryString(name)
{
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if(r!=null)return  unescape(r[2]); return null;
}